
import { fkCitylist, cityQueryXian, } from '../api/api'
export const tableminx = {
    data() {
        return {
            queryParam: { area: "", city: "" },
            ipagination: {
                current: 1,
                pageSize: 10, // 默认每页显示数量
                pageSizeOptions: ["10", "20", "30"],
                showTotal: (total, range) => {
                    return "共" + total + "条";
                },
                showQuickJumper: true,
                showSizeChanger: true,
                total: 0,
            },
            citydata: [], //行政区下拉接口(市)
            xiandata: [], //行政区下拉接口(县)
            user: JSON.parse(localStorage.getItem("user")),
            isInput: false,
            isInput2: false,
        }
    },
    mounted() {
        this.getCtiydata();
        this.changeCity();
    },
    methods: {
        //获取行政区
        async getCtiydata() {
            const res = await fkCitylist();
            if (res.code == 200) {
                const arr = res.result;
                arr.unshift({
                    name: "全部",
                    no: "",
                });
                this.citydata = arr;
            } else {
                this.$message.error(res.message);
            }

        },
        //选择行政区获取县级数据
        async changeCity(e) {
            const data = await cityQueryXian({
                cityNo: e == undefined ? this.user.fkDept.slice(0, 4) : e,
            });
            if (data.code == 200) {
                const brr = data.result;
                brr.unshift({
                    name: "全部",
                    no: "",
                });
                this.xiandata = brr;
            } else {
                this.$message.error(data.message);
            }

        },
    },
}